
import 'package:get/get.dart';

class Controller extends GetxController{
   List list = [1,2,3,4,5,6,7,8,9,0].obs;
   var count = 1.obs;
   increment(){
     count++;
   }
   var count1 = 6.obs;
   increment1(){
     count1++;
   }
   var user = User(name: "zhangsan", address: "hahahah").obs;

   deincrece(){
     list.remove(5);
     list.remove(6);
   }

   getBuilderincrement1(){
     count1++;
     update();
   }

   @override
   void onInit() {
     super.onInit();
     /// 购物车场景，监听一旦发生并计算
     ever(count1, (callback){
       print("-----${callback}");
     });

     /// 只有第一次调用，用于登录场景
     once(count1, (callback){
       print("lllllll--${callback}");
     });

     /// 用于搜索场景
     debounce(count1, (callback){
       print("ooooo--${callback}");
     },time: Duration(milliseconds: 1000));

     /// 间隔1s
     interval(count1, (callback){
       print("kkkk--${callback}");
     });

   }





}




class User{
  String  name;
  String address;
  User({required this.name,required this.address});
  @override
  String toString() {
    // TODO: implement toString

    return "${this.name} ${this.address}";
  }
}
